<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-bByq-edit" th:object="${bByq}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
			<input name="deptId" type="hidden" id="treeId"/>
			<input name="upLineId" type="hidden" id="line_id"/>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">点位ID：</label>
				<div class="col-sm-8">
					<input id="pointId" name="pointId" th:field="*{pointId}" class="form-control" type="text">
				</div>
			</div>-->
			<div class="form-group">	
				<label class="col-sm-3 control-label">设备名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">运行编号：</label>
				<div class="col-sm-8">
					<input id="runCode" name="runCode" th:field="*{runCode}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">专/公变：</label>
				<div class="col-sm-8">
					<!--<input id="zgb" name="zgb" th:field="*{zgb}" class="form-control" type="text">-->
					<!--<select id="zgb" class="form-control" name="zgb"-->
							<!--th:with="type=${@dict.getType('transformer_type')}">-->
						<!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{zgb}"></option>-->
					<!--</select>-->
					<select id="zgb" class="form-control" name="zgb" th:field="*{zgb}">
						<option value="专变">专变</option>
						<option value="公变">公变</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">规格型号：</label>
				<div class="col-sm-8">
					<input id="model" name="model" th:field="*{model}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">电压等级：</label>
				<div class="col-sm-8">
					<!--<input id="voltage" name="voltage" th:field="*{voltage}" class="form-control" type="text">-->
					<!--<select id="voltage" class="form-control" name="voltage"-->
							<!--th:with="type=${@dict.getType('voltage_grade')}">-->
						<!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{voltage}"></option>-->
					<!--</select>-->
					<select id="voltage" class="form-control" name="voltage" th:field="*{voltage}">
						<option value="10kv">10kv</option>
						<option value="400v">400v</option>
						<option value="220v">220v</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">变压器容量：</label>
				<div class="col-sm-8">
					<input id="volume" name="volume" th:field="*{volume}" class="form-control" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">所属10kv线路名称：</label>
				<div class="col-sm-8">
					<!--<input id="line10kvName" name="line10kvName" th:field="*{line10kvName}" class="form-control" type="text">-->
					<input id="line_name" name="line10kvName" th:field="*{line10kvName}" class="form-control" type="text" onclick="chooseUpLine()">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">归属单位：</label>
				<div class="col-sm-8">
					<input id="treeName" name="deptName" class="form-control" th:field="*{deptName}" type="text" onclick="selectDeptTree()">
				</div>
			</div>

			<div class="form-group">	
				<label class="col-sm-3 control-label">运维班组：</label>
				<div class="col-sm-8">
					<input id="runTeam" name="runTeam" th:field="*{runTeam}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">所属站房：</label>
				<div class="col-sm-8">
					<input id="station" name="station" th:field="*{station}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">运行状态：</label>
				<div class="col-sm-8">
					<input id="runStatus" name="runStatus" th:field="*{runStatus}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">投运日期：</label>
				<div class="col-sm-8">
					<input id="runDate" name="runDate"
						   th:value="${#dates.format(bByq.runDate,'yyyy-MM-dd')}" class="form-control" type="date">
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">生产厂家：</label>
				<div class="col-sm-8">
					<input id="factory" name="factory" th:field="*{factory}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">安装形式：</label>
				<div class="col-sm-8">
					<input id="installType" name="installType" th:field="*{installType}" class="form-control" type="text">
				</div>
			</div>-->
			<div class="form-group">	
				<label class="col-sm-3 control-label">结线别组：</label>
				<div class="col-sm-8">
					<input id="lineTeam" name="lineTeam" th:field="*{lineTeam}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">相数：</label>
				<div class="col-sm-8">
					<input id="xNumber" name="xNumber" th:field="*{xNumber}" class="form-control" type="text">
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">资产单位：</label>
				<div class="col-sm-8">
					<input id="unit" name="unit" th:field="*{unit}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">所属10kv线路ID：</label>
				<div class="col-sm-8">
					<input id="line10kvId" name="line10kvId" th:field="*{line10kvId}" class="form-control" type="text">
				</div>
			</div>-->

			<div class="form-group">	
				<label class="col-sm-3 control-label">资产性质：</label>
				<div class="col-sm-8">
					<input id="natureQuality" name="natureQuality" th:field="*{natureQuality}" class="form-control" type="text">
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">gis编码：</label>
				<div class="col-sm-8">
					<input id="gisCode" name="gisCode" th:field="*{gisCode}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">经度：</label>
				<div class="col-sm-8">
					<input id="lgt" name="lgt" th:field="*{lgt}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">纬度：</label>
				<div class="col-sm-8">
					<input id="lat" name="lat" th:field="*{lat}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">高程：</label>
				<div class="col-sm-8">
					<input id="alt" name="alt" th:field="*{alt}" class="form-control" type="text">
				</div>
			</div>-->
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">创建人：</label>
				<div class="col-sm-8">
					<input id="addUser" name="addUser" th:field="*{addUser}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">创建日期：</label>
				<div class="col-sm-8">
					<input id="addDate" name="addDate" th:field="*{addDate}" class="form-control" type="date">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">最近更新人：</label>
				<div class="col-sm-8">
					<input id="updateUser" name="updateUser" th:field="*{updateUser}" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">最近更新日期：</label>
				<div class="col-sm-8">
					<input id="updateDate" name="updateDate" th:field="*{updateDate}" class="form-control" type="date">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">数据状态：</label>
				<div class="col-sm-8">
					<input id="datastate" name="datastate" th:field="*{datastate}" class="form-control" type="text">
				</div>
			</div>-->
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "assets/bByq";
		$("#form-bByq-edit").validate({
			rules:{
                deptName:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-bByq-edit').serialize());
	        }
	    }


        /**
         * 	选择上级线路
         */
        function chooseUpLine(){
            //	打开方式一
            layer.open({
                type: 2,
                title: '上级线路选择',
                area: ['950px', '340px'],
                fixed: false, //不固定
                maxmin: true,
                content: ctx+"assets/b10kvLineInfo/choose10kvLine",
                btn: ['确定', '关闭'],
                // 弹层外区域关闭
                shadeClose: true,
                yes: function (index,layero) {
                    var body = layer.getChildFrame('body', index);//得到iframe页的body内容
                    $("#line_id").val(body.find('#line_id').val());
                    $("#line_name").val(body.find('#line_name').val());
                    layer.close(index);
                },
                cancel: function(index) {
                    return true;
                }
            });
        }



        /**
         * 	选择单位
         */
        function selectDeptTree() {
            var treeId = $("#treeId").val();
//            console.log("treeId=="+treeId)
            var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
            var url = ctx + "system/dept/selectDeptTree/" + deptId;
            var options = {
                title: '选择部门',
                width: "380",
                url: ctx + "system/dept/selectDeptTree/" + deptId,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }


        function doSubmit(index, layero){
            var tree = layero.find("iframe")[0].contentWindow.$._tree;
            if ($.tree.notAllowParents(tree)) {
                var body = layer.getChildFrame('body', index);
                $("#treeId").val(body.find('#treeId').val());
                $("#treeName").val(body.find('#treeName').val());
                layer.close(index);
            }
        }


	</script>
</body>
</html>
